From 884b94f43be7e3f0261e3dbb70f940ebaf93c897 Mon Sep 17 00:00:00 2001 From: Happy-melon Date: Sun, 6 Sep 2009 14:32:03 +0000 Subject: [PATCH] Allow password fields to be served by HTMLForm. --- includes/HTMLForm.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php index 35fb020ffe..1db26fe37a 100644 --- a/includes/HTMLForm.php +++ b/includes/HTMLForm.php @@ -21,6 +21,7 @@ class HTMLForm { 'int' => 'HTMLIntField', 'float' => 'HTMLFloatField', 'info' => 'HTMLInfoField', + 'password' => 'HTMLPasswordField', 'selectorother' => 'HTMLSelectOrOtherField', # HTMLTextField will output the correct type="" attribute automagically. # There are about four zillion other HTML 5 input types, like url, but @@ -515,6 +516,9 @@ abstract class HTMLFormField { } class HTMLTextField extends HTMLFormField { + # Override in derived classes to use other Xml::... functions + protected $mFunction = 'input'; + function getSize() { return isset( $this->mParams['size'] ) ? $this->mParams['size'] : 45; } @@ -562,7 +566,8 @@ class HTMLTextField extends HTMLFormField { } } - return Xml::input( + $func = $this->mFunction; + return Xml::$func( $this->mName, $this->getSize(), $value, @@ -571,6 +576,10 @@ class HTMLTextField extends HTMLFormField { } } +class HTMLPasswordField extends HTMLTextField { + protected $mFunction = 'password'; +} + class HTMLFloatField extends HTMLTextField { function getSize() { return isset( $this->mParams['size'] ) ? $this->mParams['size'] : 20; -- 2.20.1